/*
 * terminator.cpp
 *
 *  Created on: Oct 30, 2013
 *      Author: m
 */

#include <iostream>
#include <cstdlib>
#include "DefinicionesComunes.h"
#include "NewMessageQueue.h"
#include "NewSemaphore.h"
#include "NewSharedMemory.h"
#include "Sequence.h"
#include "CPrinter.h"

using namespace ipc;

int main( int argc, char* argv[] )
{
    CPrinter::setHeader( "terminator" );

    // Destruyo todos los IPCs
    SharedMemory<int>::destroy( IPC_BASE_FILE, SHM_CONT_LCON );
    SharedMemory<int>::destroy( IPC_BASE_FILE, SHM_CONT_LECT );
    SharedMemory<float>::destroy( IPC_BASE_FILE, SHM_BOARD );
    Semaphore::destroy( IPC_BASE_FILE, SEM_ENTRADA );
    Semaphore::destroy( IPC_BASE_FILE, SEM_CONT_LECT );
    Semaphore::destroy( IPC_BASE_FILE, SEM_ESCRITOR );
    Sequence::destroy( IPC_BASE_FILE, SEQ_ID_LECTOR );
    Sequence::destroy( IPC_BASE_FILE, SEQ_ID_ESCRIT );

    Semaphore::destroy( IPC_BASE_FILE, SEM_INICIO );

    //Nota: los procesos se mueren solos al destruir sus IPCs

    return 0;
}
